package com.escriba.DWR;

import java.util.ArrayList;
import java.util.List;

import org.directwebremoting.annotations.RemoteMethod;
import org.directwebremoting.annotations.RemoteProxy;
import org.springframework.stereotype.Service;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

import com.escriba.logic.form.Contact;

@Service
@RemoteProxy
public class DwrTest {

	@RemoteMethod
	public List<Integer> getStuff() {
		List<Integer> list = new ArrayList<Integer>();
		for (int i = 0; i < 100; i++) {
			list.add(i);
		}
		return list;
	}
	
	@RemoteMethod
	
	public String cadena(@ModelAttribute("contact")
			Contact contact, BindingResult result){
		System.out.println("First Name:" + contact.getFirstname() +
					"Last Name:" + contact.getLastname());
		/*Map<String, String> map = new HashMap<String, String>();
		map.put("first", contact.getFirstname());
		map.put("last", contact.getLastname());*/
		return contact.getFirstname() +" "+ contact.getLastname() ;
	}

}
